package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.HospitalCampus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DepartmentsMapper;
import com.ruoyi.system.domain.Departments;
import com.ruoyi.system.service.IDepartmentsService;

/**
 * 科室信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-26
 */
@Service
public class DepartmentsServiceImpl implements IDepartmentsService 
{
    @Autowired
    private DepartmentsMapper departmentsMapper;

    // DepartmentsServiceImpl.java 实现方法
    @Override
    public List<String> selectDepartmentNames() {
        return departmentsMapper.selectDepartmentNames();
    }

    /**
     * 查询科室信息
     * 
     * @param id 科室信息主键
     * @return 科室信息
     */
    @Override
    public Departments selectDepartmentsById(Integer id)
    {
        return departmentsMapper.selectDepartmentsById(id);
    }

    /**
     * 查询科室信息列表
     * 
     * @param departments 科室信息
     * @return 科室信息
     */
    @Override
    public List<Departments> selectDepartmentsList(Departments departments)
    {
        return departmentsMapper.selectDepartmentsList(departments);
    }

    /**
     * 新增科室信息
     * 
     * @param departments 科室信息
     * @return 结果
     */
    @Override
    public int insertDepartments(Departments departments)
    {
        return departmentsMapper.insertDepartments(departments);
    }

    /**
     * 修改科室信息
     * 
     * @param departments 科室信息
     * @return 结果
     */
    @Override
    public int updateDepartments(Departments departments)
    {
        return departmentsMapper.updateDepartments(departments);
    }

    /**
     * 批量删除科室信息
     * 
     * @param ids 需要删除的科室信息主键
     * @return 结果
     */
    @Override
    public int deleteDepartmentsByIds(Integer[] ids)
    {
        return departmentsMapper.deleteDepartmentsByIds(ids);
    }

    /**
     * 删除科室信息信息
     * 
     * @param id 科室信息主键
     * @return 结果
     */
    @Override
    public int deleteDepartmentsById(Integer id)
    {
        return departmentsMapper.deleteDepartmentsById(id);
    }

    /** 获取所有院区的名称信息*/
    public List<HospitalCampus> getHospitalCampusName(){
        return departmentsMapper.getHospitalCampusName();
    }

    /** 根据院区id删除科室信息*/
    @Override
    public int deleteDepartmentsByCampusId(Integer campusId) {
        return departmentsMapper.deleteDepartmentsByCampusId(campusId);
    }
    //根据院区名称查找科室
    public List<Departments> getDepartmentsByhospitalArea(String hospitalArea){
        return departmentsMapper.getDepartmentsByhospitalArea(hospitalArea);
    }

}
